// 发帖、帖内相关API

import { ApiBase } from 'Api/base/apiBase'
import * as Params from 'Api/post/params'
import * as Responses from 'Api/post/responses'

class PostApi extends ApiBase {
  //发表动态
  writeArticle(params: Params.WriteArticleReq) {
    return this.post('/moment', params)
  }

  getArticle(params: Params.GetArticleReq) {
    return this.post<Responses.GetArticleRes>('/article/user', params)
  }
  
  uploadAvatar(avatar:Blob){
    const file = new FormData()
    file.append('avatar',avatar)
    return this.post('/upload/avatar',file)
  }

  deleteComment(commentid:number){
    return this.delete(`/comment/${commentid}`)
  }

}

export default PostApi
